package com.bsdsma.fengheguaiapp.utils;


import com.bsdsma.fengheguaiapp.entity.User;

public class LocalUtils {

    private static final ThreadLocal<User> USER_INFO_THREAD_LOCAL =
            new ThreadLocal<>();

    /**
     * 清除用户信息
     */
    public static void clearUser() {
        USER_INFO_THREAD_LOCAL.remove();
    }

    /**
     * 存储用户信息
     */
    public static void setUser(User user) {
        USER_INFO_THREAD_LOCAL.set(user);
    }

    /**
     * 获取当前用户信息
     */
    public static User getUser() {
        return USER_INFO_THREAD_LOCAL.get();
    }
}
